package com.snpic.appaw.module.insure.dal.mysql.vehicleInformation;

import java.util.*;

import com.snpic.appaw.framework.common.pojo.PageResult;
import com.snpic.appaw.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.snpic.appaw.framework.mybatis.core.mapper.BaseMapperX;
import com.snpic.appaw.module.insure.dal.dataobject.vehicleInformation.VehicleInformationDO;
import org.apache.ibatis.annotations.Mapper;
import com.snpic.appaw.module.insure.controller.app.vehicleInformation.vo.*;

/**
 * 首页车辆卡片/编辑家庭档案 - 车辆信息 Mapper
 *
 * @author jijun
 */
@Mapper
public interface VehicleInformationMapper extends BaseMapperX<VehicleInformationDO> {

	default PageResult<VehicleInformationDO> selectPage(AppVehicleInformationPageReqVO reqVO) {
		return selectPage(reqVO, new LambdaQueryWrapperX<VehicleInformationDO>()
			.eqIfPresent(VehicleInformationDO::getLicensePlateNumber, reqVO.getLicensePlateNumber())
			.eqIfPresent(VehicleInformationDO::getVehicleType, reqVO.getVehicleType())
			.eqIfPresent(VehicleInformationDO::getFrameNumber, reqVO.getFrameNumber())
			.eqIfPresent(VehicleInformationDO::getEngineNumber, reqVO.getEngineNumber())
			.betweenIfPresent(VehicleInformationDO::getRegistrationDate, reqVO.getRegistrationDate())
			.eqIfPresent(VehicleInformationDO::getUserId, reqVO.getUserId())
			.betweenIfPresent(VehicleInformationDO::getQueryTime, reqVO.getQueryTime())
			.eqIfPresent(VehicleInformationDO::getIsAuthentication, reqVO.getIsAuthentication())
			.betweenIfPresent(VehicleInformationDO::getCreateTime, reqVO.getCreateTime())
			.eqIfPresent(VehicleInformationDO::getRemark, reqVO.getRemark())
			.eqIfPresent(VehicleInformationDO::getCarOwner, reqVO.getCarOwner())
			.eqIfPresent(VehicleInformationDO::getCarSource, reqVO.getCarSource())
			.eqIfPresent(VehicleInformationDO::getIsOpen, reqVO.getIsOpen())
			.eqIfPresent(VehicleInformationDO::getTimeSpan, reqVO.getTimeSpan())
			.betweenIfPresent(VehicleInformationDO::getCustomingzingTime, reqVO.getCustomingzingTime())
			.eqIfPresent(VehicleInformationDO::getBrandModel, reqVO.getBrandModel())
			.eqIfPresent(VehicleInformationDO::getTransfered, reqVO.getTransfered())
			.eqIfPresent(VehicleInformationDO::getInsuredArea, reqVO.getInsuredArea())
			.eqIfPresent(VehicleInformationDO::getVehicleLisenceUrl, reqVO.getVehicleLisenceUrl())
			.eqIfPresent(VehicleInformationDO::getIdType, reqVO.getIdType())
			.eqIfPresent(VehicleInformationDO::getIdNo, reqVO.getIdNo())
			.eqIfPresent(VehicleInformationDO::getOwnerStatus, reqVO.getOwnerStatus())
			.eqIfPresent(VehicleInformationDO::getSelectStatus, reqVO.getSelectStatus())
			.eqIfPresent(VehicleInformationDO::getSelectStatusForQuote, reqVO.getSelectStatusForQuote())
			.eqIfPresent(VehicleInformationDO::getCitycode,reqVO.getCitycode())
			.orderByDesc(VehicleInformationDO::getId));
	}


	default List<VehicleInformationDO> selectList(AppVehicleInformationPageReqVO reqVO) {
		return selectList(new LambdaQueryWrapperX<VehicleInformationDO>()
			.eqIfPresent(VehicleInformationDO::getId, reqVO.getId())
			.eqIfPresent(VehicleInformationDO::getLicensePlateNumber, reqVO.getLicensePlateNumber())
			.eqIfPresent(VehicleInformationDO::getVehicleType, reqVO.getVehicleType())
			.eqIfPresent(VehicleInformationDO::getFrameNumber, reqVO.getFrameNumber())
			.eqIfPresent(VehicleInformationDO::getEngineNumber, reqVO.getEngineNumber())
			.betweenIfPresent(VehicleInformationDO::getRegistrationDate, reqVO.getRegistrationDate())
			.eqIfPresent(VehicleInformationDO::getUserId, reqVO.getUserId())
			.betweenIfPresent(VehicleInformationDO::getQueryTime, reqVO.getQueryTime())
			.eqIfPresent(VehicleInformationDO::getIsAuthentication, reqVO.getIsAuthentication())
			.betweenIfPresent(VehicleInformationDO::getCreateTime, reqVO.getCreateTime())
			.eqIfPresent(VehicleInformationDO::getRemark, reqVO.getRemark())
			.eqIfPresent(VehicleInformationDO::getCarOwner, reqVO.getCarOwner())
			.eqIfPresent(VehicleInformationDO::getCarSource, reqVO.getCarSource())
			.eqIfPresent(VehicleInformationDO::getIsOpen, reqVO.getIsOpen())
			.eqIfPresent(VehicleInformationDO::getTimeSpan, reqVO.getTimeSpan())
			.betweenIfPresent(VehicleInformationDO::getCustomingzingTime, reqVO.getCustomingzingTime())
			.eqIfPresent(VehicleInformationDO::getBrandModel, reqVO.getBrandModel())
			.eqIfPresent(VehicleInformationDO::getTransfered, reqVO.getTransfered())
			.eqIfPresent(VehicleInformationDO::getInsuredArea, reqVO.getInsuredArea())
			.eqIfPresent(VehicleInformationDO::getVehicleLisenceUrl, reqVO.getVehicleLisenceUrl())
			.eqIfPresent(VehicleInformationDO::getIdType, reqVO.getIdType())
			.eqIfPresent(VehicleInformationDO::getIdNo, reqVO.getIdNo())
			.eqIfPresent(VehicleInformationDO::getOwnerStatus, reqVO.getOwnerStatus())
			.eqIfPresent(VehicleInformationDO::getSelectStatus, reqVO.getSelectStatus())
			.eqIfPresent(VehicleInformationDO::getSelectStatusForQuote, reqVO.getSelectStatusForQuote())
			.eqIfPresent(VehicleInformationDO::getCitycode,reqVO.getCitycode())
			.orderByDesc(VehicleInformationDO::getId));
	}

}